from django.db.models import Avg, Count
from django.db.models.query import QuerySet
from books.models import *


def run():
    # qs = Books.objects.all().values('author').annotate(avg_price=Avg('price'), book_count=Count('id')).order_by('book_count')
    # qs = Books.objects.all().annotate(book_count=Count('id'))
    # print(qs)
    # qs = Books.objects.all().values('author').annotate(book_count=Count('id'))
    # print(qs)
    # qs = Books.objects.all().annotate(book_count=Count('id')).values('author')
    # print(qs)
    qs = Books.objects.all().values('author').annotate(book_count=Count('id')).values('book_count')
    print(qs)
    # for q in qs:
    #     print(q)
